All Questions
3 questions
3votes
1answer
2kviews
Counting subtrees where all nodes have the same value
A unival tree (which stands for "universal value") is a tree where all nodes under it have the same value. Given the root to a binary tree, count the number of unival subtrees. For example,...
5votes
1answer
2kviews
Pramp: Sales path
the question is taken from Pramp(really cool site!) there is a more straight forward solution. using recursion. but I thought trying it using BFS. please review only the code of GetCheapestCost ...
3votes
1answer
1kviews
Find all k-sum paths in a binary tree
Description: Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. Note: A leaf is a node with no children. Leetcode Code: ...